export type PatternCategory = 'creational' | 'structural' | 'behavioral';

export type PatternDifficulty = '简单' | '中等' | '困难';

export interface DesignPattern {
  id: string;
  name: string;
  category: PatternCategory;
  difficulty: PatternDifficulty;
  description: string;
  principles: string[];
  useCases: string[];
  advantages: string[];
  disadvantages: string[];
  code: string;
  demoCode?: string;
  realWorldExamples: RealWorldExample[];
  bestPractices: string[];
  icon: string;
}

export interface RealWorldExample {
  title: string;
  description: string;
  code: string;
}

export interface TabContent {
  id: string;
  label: string;
  icon: string;
  component: React.ComponentType;
}

export interface DemoState {
  isRunning: boolean;
  isPaused: boolean;
  currentStep: number;
  totalSteps: number;
  output: string[];
  visualization: any;
}

export interface PatternFilter {
  category: PatternCategory | 'all';
  difficulty: PatternDifficulty | 'all';
  search: string;
}

export interface AppState {
  currentPattern: DesignPattern | null;
  selectedCategory: PatternCategory | 'all';
  selectedTab: string;
  demoState: DemoState;
  filter: PatternFilter;
  patterns: DesignPattern[];
}

export interface PatternCardProps {
  pattern: DesignPattern;
  isActive: boolean;
  onClick: (pattern: DesignPattern) => void;
}

export interface SidebarProps {
  patterns: DesignPattern[];
  selectedCategory: PatternCategory | 'all';
  onCategoryChange: (category: PatternCategory | 'all') => void;
  onPatternSelect: (pattern: DesignPattern) => void;
  currentPattern: DesignPattern | null;
}

export interface PatternDetailProps {
  pattern: DesignPattern;
  onBack: () => void;
}

export interface CodeViewerProps {
  code: string;
  language?: string;
  onRun?: () => void;
  onCopy?: () => void;
}

export interface DemoViewerProps {
  pattern: DesignPattern;
  demoState: DemoState;
  onStart: () => void;
  onPause: () => void;
  onReset: () => void;
  onStep: () => void;
}

export interface VisualizationProps {
  pattern: DesignPattern;
  data: any;
}
